<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('流程任务委托')" />
    <style type="text/css">
        .layui-input, .layui-textarea{width: 85%;}
        .layui-form-label{width:160px}
        .layui-form-select dl{margin-left:12%;min-width:80%;}
        .layui-edge{margin-right:7%}
    </style>
</head>
<body>
<form class="layui-form" id="form-task-delegate" style="padding: 16px 84px 16px 25px;">
    <input type="hidden" id="taskId" name="taskId" th:value="${taskId}">
    <input type="hidden" id="userId" name="userId" value="">
    <div class="layui-form-item">
        <label class="layui-form-label">简短附言：</label>
        <div class="layui-input-block">
            <textarea id="comment" name="comment" class="layui-textarea" placeholder="请输入内容" style="height:170px;"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><font class="f_red">*</font>选择委托代办人：</label>
        <div class="layui-input-block">
            <input type="text" name="userName" id="userName"  lay-verify="required" autocomplete="off" placeholder="请选择" class="layui-input" readonly>
            <i class="layui-icon layui-icon-more" style="position: absolute;top:7px;right: 40px;"></i>
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit="" lay-filter="btn_save" id="btn_save" value="提交">
    </div>
</form>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    /*<![CDATA[*/
    var prefix = ctx + "flowable/task";
    /*]]>*/
</script>
<script>
    var $,layer,form;
    layui.use(['form','layer','jquery'], function () {
        $ = layui.$,layer = layui.layer,form = layui.form;
    });
    //点击打开model选择页
    $('.layui-icon-more').on('click', function () {
        $.modal.open("选择人员", "/system/user/userselect?pagetype=radio", 680, 470, function(index){
            var res = window["layui-layer-iframe" + index].callbackdata();
            if(!res){
            	layer.msg("请选择人员！", {icon:7});
            }else{
                $("#userId").val(res.userId);
                $("#userName").val(res.userName);
                layer.close(index);
            }
        });
    });
    //提交调用的方法
    function submitHandler() {
        if ($.validate.form()) {
            var data = $('#form-task-delegate').serializeArray();
            $.operate.save(prefix + "/taskDelegatePost", data);
        }
    }
    function successCallback(result) {
        if(result.code == "0"){
            parent.layer.closeAll();
        	parent.$('#btn-search0').click();
        }
    }
</script>
</body>
</html>